#ifndef _ACCEPT_H_
#define _ACCEPT_H_
#include"Socket.h"
#include"Address.h"
#include<string>

using std::string;

namespace http_server
{
    class Accept
    {
    public:
        Accept(const size_t port);
        Accept(const string& ip, const size_t port);
        Accept(const sockaddr_in& addr);
        
        //Func
        void Start();    // socket, bind(), listen(), accept(). All Processes
        int getCfd();   // get connectfd
        int getFd();
    private:
        void reuseAddr(bool flag);
        void reusePort(bool flag);
        void Bind();
        void Listen(int size);

    private:
        Socket _sock;
        Address _addr;
    };

}

#endif